﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Web.Model
{
    public class Retful
    {
        private Retful()
        {

        }
        public string ErrorCode { get; set; }

        public string ErrorMsg { set; get; }
        public dynamic Value { get; set; }

        public static Retful CreateFail(string errorMsg, dynamic para = null)
        {
            return new Retful()
            {
                ErrorCode = "-1",
                ErrorMsg = errorMsg,
                Value = para

            };
        }
        public static Retful CreateSuccess(dynamic para = null)
        {
            return new Retful()
            {
                ErrorCode = "0",
                ErrorMsg = string.Empty,
                Value = para

            };
        }
        public static Retful CreateRetful(int errorCode, string errorMsg, dynamic para = null)
        {
            return new Retful()
            {
                ErrorCode = errorCode.ToString(),
                ErrorMsg = errorMsg,
                Value = para

            };
        }
    }
}